import request from '@/utils/request'

/**
 * 获取权限列表
 */
const getPermissionList = () => {
  return request({ url: '/sys/permission' })
}

/**
 *
 * @param {*} data
 * @returns
 * 新增权限
 */
const addPermission = (data) => {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

/**
 *
 * @param {*} data
 * @returns 更新权限
 */
const updatePermission = (data) => {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}

/**
 *
 * @param {*} id
 * @returns 删除权限
 */
const delPermission = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

/**
 *
 * @param {*} id
 * @returns 获取权限详情
 */
const getPermissionDetail = (id) => {
  return request({
    url: `/sys/permission/${id}`
  })
}

export {
  getPermissionList,
  updatePermission,
  delPermission,
  getPermissionDetail,
  addPermission
}
